﻿namespace TestDoc
{
    public sealed class MethodInfoSmall
    {
        private readonly string _typeName;
        private readonly MethodType _typeCode;

        public MethodInfoSmall(MethodType typeCode, string typeName)
        {
            _typeName = typeName;
            _typeCode = typeCode;
        }

        public string TypeName
        {
            get { return _typeName; }
        }

        public MethodType TypeCode
        {
            get { return _typeCode; }
        }

        public override string ToString()
        {
            return _typeName;
        }

        public override bool Equals(object obj)
        {
            if (base.Equals(obj) || this == obj)
                return true;

            var methodInfo = obj as MethodInfoSmall;

            if (methodInfo != null && (PropertiesEqual(methodInfo)))
                return true;

            return false;
        }

        private bool PropertiesEqual(MethodInfoSmall compareTo)
        {
            if (_typeName != compareTo.TypeName || compareTo.TypeCode != _typeCode)
                return false;

            return true;

        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
